{template 'weheader'}
<style>
body{background-color:#f0f0f0;font-weight:300;}
.info{background-color:#fff8e1;font-weight:300;}
.weui_tab a{color:#555}
.weui_navbar{line-height:20px;}
.weui_media_box.weui_media_text .weui_media_info {margin-top: 0px;}

.dayu_cells {overflow: hidden;position: relative;}
.sticky-fixed {width: 100%;position: fixed;bottom: 0;z-index:9998;}
.weui-header-right a{padding-left:10px;}
</style>
{if $operation == 'display'}
<script type="text/javascript">
$(function(){
	var rhtml = '<span class="weui-badge" style="position: absolute;top: 2px;right: 2px;">{$total}</span>';
	$('.weui_bar_item_on').append(rhtml);
});
</script>
<style>
.weui_tabbar_item {position: relative;}
.record-start-btn {width:18px;height:18px;margin-right:5px;}
.weui_cells {margin-top:0px;}
.weui_cell img, .weui_media_title img{width:25px;height:25px;}
.bg-gray{background-color:#f0f0f0;}
.dayu_list{font-size:14px;}
.weui_cell_primary .middle{margin-right:10px;}
.weui_media_info_meta{margin-top:5px;}
.ico_scored{margin:5px 0 0 5px;}
</style>
	<div class="weui_tab_bd">
	{if $reid}
		<div class="bg-blue weui-header "> 
			<div class="weui-header-left">{$mname}</div>
			<h1 class="weui-header-title"></h1>
			<div class="weui-header-right">
				<a href="{php echo $this->createMobileUrl('dayu_form', array('id' => $reid))}">
					<svg class="icon f-white" aria-hidden="true">
						<use xlink:href="#icon-home"></use>
					</svg>
				</a>
			</div>
		</div>
		{if $activity['isinfo']}
		<div class="weui_panel weui_panel_access" style="margin:0;">
			<div class="weui_panel_bd">
				<div class="weui_media_box weui_media_text" style="padding:10px 15px;">
					<h4 class="weui_media_title">{$par['business']}</h4>
					<p class="weui_media_desc"><a href="tel:{$par['tel']}">电话：{$par['tel']}</a></p>
				</div>
			</div>
			<div class="weui_panel_ft f12" onclick="location.href='http://api.map.baidu.com/marker?location={$par['lat']},{$par['lng']}&title={php echo urlencode($activity[business]);}&content={php echo urlencode($par[address].' 电话'.$par['tel']);}&output=html'">地址：{$par['address']}</div>
		</div>
		<div class="weui_panel weui_panel_access">
		{else}
		<div class="weui_panel weui_panel_access" style="margin:0;">
		{/if}
	

		{loop $rows $item}
            <div class="weui_panel_bd" onclick="location.href='{php echo $this->createMobileUrl('mydayu_form', array('op' => 'detail', 'rerid' => $item['rerid'], 'id' => $reid))}'">
                <div class="weui_media_box weui_media_text weui_panel_ft">
                    <h4 class="weui_media_title">
						<img src="{if !empty($item['user']['tag']['avatar'])}{$item['user']['tag']['avatar']}{else}{MODULE_URL}template/weui/images/noface.jpg{/if}" class="middle img-circle">
						{if $activity['paixu']!=2}{$item['member']} <small class="">{$item['mobile']}</small>{else}{$item['user']['nickname']}{/if}
					</h4>
                    <p class="weui_media_desc">
						{loop $children[$item['rerid']] $d}
							{if strstr($d['data'], 'images') || strstr($d['data'], 'attachment')}
								有图,
							{elseif $d['data']}
								{$d['data']},
							{else}
							{/if}
						{/loop}
					</p>
                    <ul class="weui_media_info">
                        <li class="weui_media_info_meta">提交时间：{php echo date('Y/m/d H:i', $item['createtime'])}</li>
						{if !empty($item['commentid'])}
						<span class="ico_scored right"><strong class="score_{$item['comment']['score']}"></strong></span>
						{/if}
                    </ul>
                </div>
            </div>
			<div class="dayu_cells bg-gray">
			<div class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
					{if !empty($item['kf'])}<img src="{if !empty($item['kf']['tag']['avatar'])}{$item['kf']['tag']['avatar']}{else}{MODULE_URL}template/weui/images/noface.jpg{/if}" class="left middle img-circle"> {/if}
				</div>
				<div class="weui_cell_ft">
					{if !empty($item['rethumb'])}<div class="left"><i class="record-start-btn iconfont f15 f-white">&#xe61e;</i></div>{/if}
					{if !empty($item['revoice'])}<div class="left"><i class="record-start-btn iconfont f15 f-white">&#xe62a;</i></div>{/if}
					<span class="weui_btn weui_btn_mini {$item['status']['css']}">{$item['status']['name']}</span>
				</div>
			</div>
			</div>
		{/loop}
		</div>
		{if $pager}<div class="p bg-gray" style="height:32px;">{$pager}</div>{/if}		
		</div>
	</div>
	{else}
		{if $fids}
		<style>
			.dayu-header {padding: 25px 0;}
			.dayu-title {text-align: center;font-size: 25px;color: #3cc51f;font-weight: 400;margin: 0;}
			.dayu-sub-title {color: #888;padding:0 10px;font-size: 14px;text-indent:2em;}
			.dayu-content-padded {padding: 15px;}
			.dayu-second-title {text-align: center;font-size: 24px;color: #3cc51f;font-weight: 400;margin: 0 15%;}
		</style>
			<header class='dayu-header'>
				<h1 class="dayu-title">选择主题</h1>
			</header>
			<div class="weui_tab" style="margin:0 10%;">
			{loop $list $item}
				<a href="{php echo $this->createMobileUrl('mydayu_form', array('weid' => $item[weid], 'id' => $item[reid]))}" class="weui_btn weui_btn_primary" style="color:#fff;">{$item['title']}</a>
			{/loop}
			</div>
		{else}
			<div class="weui_msg">
				<div class='notice '><p><i class="iconfont f22">&#xe61f;</i> 暂无数据</p></div>
			</div>
		{/if}
	{/if}
{elseif $operation == 'detail'}
<script type="text/javascript">
</script> 
<style>
.weui_cell_ft {margin-left:10px;font-size:14px;}
.weui_cell_bd {font-size:16px;}
.weui_cells_title {margin-top: 10px;}
#allmap{width:100%;height:200px;display:block}
#allmap img{height:1rem;}

.weui_media_box{padding:10px 15px 5px;}
.weui_panel_hd{color:#333;}
.weui_media_box .weui_media_title, .weui_media_box .weui_media_desc{color:#666;line-height:22px;padding:0;}
.weui_panel .icon{margin-right:2px;}
label{font-weight:700;}
.content .weui_media_desc:after{border-bottom: 1px solid #D9D9D9;}

.f-grays{color:#999;}
</style>
<div class="weui_tab_bd">
		<div class="weui-header bg-blue" style="background-color:{$setting['orderbg']}"> 
			<div class="weui-header-left">
				<a href="javascript:history.go(-1)">
					<svg class="icon f-white" aria-hidden="true">
						<use xlink:href="#icon-left"></use>
					</svg>
				</a>
			</div>
			<h1 class="weui-header-title f16"></h1>
			<div class="weui-header-right">
				<a href="{php echo $this->createMobileUrl('dayu_form', array('id' => $reid))}">
					<svg class="icon f-white" aria-hidden="true">
						<use xlink:href="#icon-home"></use>
					</svg>
				</a>
				<a class="" href="{php echo $this->createMobileUrl('mydayu_form', array('id' => $reid))}">
					<svg class="icon f-white" aria-hidden="true">
						<use xlink:href="#icon-dd"></use>
					</svg>
				</a>
			</div> 
		</div>
	<div class="weui_panel weui_panel_access">
		<div class="weui_media_box weui_media_small_appmsg">
			<div class="weui_cells weui_cells_access">
				<div class="weui_cell" style="line-height:12px;">
					<div class="weui_cell_hd">
						<svg class="icon f20 f-orange" aria-hidden="true">
							<use xlink:href="#icon-jihuajindu"></use>
						</svg>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<label class="f14">信息</label>
					</div>
					<div class="right block">
						{if $row['status'] == 0}<span class="weui_btn f12 weui_btn_mini weui_btn_default">{$state1}</span>
						{elseif $row['status'] == 1}<span class="weui_btn f12 weui_btn_mini weui_btn_primary">{$state2}</span>
						{elseif $row['status'] == 2}<span class="weui_btn f12 weui_btn_mini weui_btn_warn">{$state4}</span>
						{elseif $row['status'] == 3}<span class="weui_btn f12 weui_btn_mini bg-blue">{$state3}</span>
						{elseif $row['status'] == -1}<span class="weui_btn f12 weui_btn_mini weui_btn_disabled weui_btn_warn">{$state5}</span>
						{/if}
					</div>
					{if $par['isdel']==1 && $row['status'] == '0'}<a href="{php echo $this->createMobileUrl('dayu_formDelete', array('id' => $row['rerid'],'openid' => $openid, 'reid' => $activity['reid']))}" onclick="return confirm('删除本记录，此操作不可恢复，确认删除？');return false;" class="weui_btn weui_btn_mini f12 right weui_btn_warn f-white" style="margin-left:5px;">删除此记录</a>{/if}
				</div>
			</div>
		</div>
		<div class="weui_panel_bd" id="comment">
			<div class="weui_media_box weui_media_appmsg">
				<div class="weui_media_bd">
					<h4 class="weui_media_title">{if $activity['paixu']!=2}{$row['member']} <small style="margin-left:10px;">{$row['mobile']}</small>{else}{$row['user']['nickname']}{/if}</h4>
					<p class="weui_media_desc">提交时间：{$row['createtime']}</p>
				</div>
			</div>
		</div>
	</div>
	<div class="weui_panel weui_panel_access">
		<div class="weui_media_box weui_media_small_appmsg">
			<div class="weui_cells weui_cells_access">
				<div class="weui_cell" style="line-height:12px;">
					<div class="weui_cell_hd">
						<svg class="icon f20 f-orange" aria-hidden="true">
							<use xlink:href="#icon-xinzeng"></use>
						</svg>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<label class="f14">受理进度</label>
					</div>
					<div class="right block">
						<span class="weui_btn f12 weui_btn_mini {$status['css']}" {if $row['status']=='8'}onclick="location.href='{php echo $this->createMobileUrl('edit', array('reid' => $reid, 'rerid' => $rerid))}'">
							<svg class="icon f-white" aria-hidden="true">
								<use xlink:href="#icon-business-signature"></use>
							</svg>{else}>{/if} {$status['name']}
						</span>
					</div>
				</div>
			</div>
		</div>
		<div class="weui_cells weui_cells_access" style="margin:-1px 0 0;">
			{if !empty($row['kfinfo'])}
			<div class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
					<span class="weui_textarea">{$row['kfinfo']}</span>
					<div class="weui_textarea_counter"><small>{$row['yuyuetime']}</small></div>
				</div>
			</div>
			{/if}
			{if $activity['isrethumb'] && !empty($row['rethumb'])}
			<div class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
					<div class="weui_uploader">
						<div class="weui_uploader_bd">
							<ul class="weui_uploader_files">                        
						    {loop $row['rethumb'] $key $pic}
								<img src="{php echo tomedia($pic)}" onclick="show(this,'show{$id}{$key}')" id="show{$id}{$key}" class="weui_uploader_file weui_uploader_status">
						    {/loop}
							</ul>
						</div>
					</div>
				</div>
			</div>
			{/if}
			{if $activity['isrevoice'] && !empty($row['revoice'])}
				<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span id="voice"><audio preload="auto" controls><source src="{if strstr($row['revoices'], 'http://')}{$row['revoices']}{else}{$setting['qiniu']['host']}/{$row['revoices']}{/if}" /></audio>
					</div>
					<div class="weui_cell_ft">语音答复</div>
				</div>
			{/if}
			{if !empty($row['file'])}
				{php $file=1;}
				{loop $row['file'] $f}
				<a class="weui_cell" href="{$f}">
					<div class="weui_cell_bd weui_cell_primary">
						<p>点击保存到手机</p>
					</div>
					<div class="weui_cell_ft">文件下载 {$file}</div>
				</a>
				{php $file++}
				{/loop}
			{/if}
		</div>
	</div>
	
{if !empty($par['comment']) && pdo_tableexists('dayu_comment') && empty($row['commentid']) && $row['status'] == 3}
	{if $par['consult']=='1'}
	<div class="weui_btn_area">
		<div class="weui-flex">
            <div class="weui-flex-item"><span class="weui_btn weui_btn_default left" onclick="postscore(this,0)">咨询历史</span></div>
            <div class="weui-flex-item" id="postscore"><span class="weui_btn weui_btn_primary right" onclick="postscore(this,0)">评价打分</span></div>
		</div>
	</div>
	{else}
	<div class="weui_btn_area" id="postscore">
		<span class="weui_btn weui_btn_primary" onclick="postscore(this,0)">评价打分</span>
	</div>
	{/if}
{else if $row['status'] != 3 && $par['consult']=='1'}
	<div class="weui_btn_area" style="position: relative;">
		<a class="weui_btn weui_btn_primary f-white" href="{php echo $this->createMobileUrl('consult',array('reid'=>$reid,'rerid'=>$rerid,'cid'=>$par['consult']));}">在线咨询</a>
		{$c_tishi}
	</div>
{/if}
	<div class="weui_panel weui_panel_access">
		<div class="weui_media_box weui_media_small_appmsg" id="content">
			<div class="weui_cells weui_cells_access">
				<a href="javascript:;" class="weui_cell" style="line-height:12px;">
					<div class="weui_cell_hd">
						<svg class="icon f20 f-orange" aria-hidden="true">
							<use xlink:href="#icon-wancheng"></use>
						</svg>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<label class="f14">内容</label>
					</div>
				</a>
			</div>
		</div>
		<div class="weui_panel_bd" id="menu_content">
			{if pdo_tableexists('dayu_kami') && !empty($par['kami']) && !empty($row['kid'])}
			<div class="weui_cell">
				<div class="weui_cell_hd weui_cell_primary">{$kami['number']}</div>
				<div class="weui_cell_bd">卡密</div>
			</div>
			{/if}
			{if !empty($row['linkage'])}
			<div class="weui_cell">
				<div class="weui_cell_hd weui_cell_primary f14 f-grays">{$la['l1']}</div>
				<div class="weui_cell_bd">{$linkage['l1']['title']}</div>
			</div>
			<div class="weui_cell">
				<div class="weui_cell_hd weui_cell_primary f14 f-grays">{$la['l2']}</div>
				<div class="weui_cell_bd">{$linkage['l2']['title']}</div>
			</div>
			{/if}
			{loop $ds $fid $ftitle}
				{if $ftitle['type'] == 'image' && !empty($ftitle['loc'])}
				{else}
				<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
					<h5>{$ftitle['fid']}：</h5>
					{if in_array($ftitle['type'], array('image', 'photograph'))}
						{if $row['fields'][$fid]}
							<image class="weui_uploader_file weui_uploader_status" id="p{$fid}" src="{php echo tomedia($row['fields'][$fid]);}" height="50">
							<script>
							document.querySelector('#p{$fid}').onclick = function () {
								wx.previewImage({
									current: '{php echo tomedia($row['fields'][$fid]);}',
									urls: [
									'{php echo tomedia($row['fields'][$fid]);}'
									]
								});
							};
							</script>
						{else}
							未上传
						{/if}
					{else}
						{if !empty($row['fields'][$fid])}{$row['fields'][$fid]}{else}未填写{/if}
					{/if}
					</div>
				</div>
				{/if}
			{/loop}
		</div>
	</div>
	{if !empty($row['voice']) || !empty($row['thumb'])}
	<div class="weui_panel weui_panel_access">
		<div class="weui_media_box weui_media_small_appmsg">
			<div class="weui_cells weui_cells_access">
				<div class="weui_cell" style="line-height:12px;">
					<div class="weui_cell_hd">
						<svg class="icon f20 f-orange" aria-hidden="true">
							<use xlink:href="#icon-jihua"></use>
						</svg>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<label class="f14">多媒体内容</label>
					</div>
					<small class="right f-orange">
					</small>
				</div>
			</div>
		</div>

		<div class="weui_panel_bd">
			{if $activity['isvoice']==1 && !empty($row['voice'])}
			<div class="weui_cell">
				<div class="weui_cell_hd weui_cell_primary">
					<audio id="mp3" src="{if strstr($row['voices'], 'http://')}{$row['voices']}{else}{$setting['qiniu']['host']}/{$row['voices']}{/if}" preload="meta" controls></audio>
				</div>
				<div class="weui_cell_bd f12" id="voice">
					{$activity['voice']}
				</div>
			</div>
			{/if}
			{if !empty($row['thumb'])}
			<div class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
					<div class="weui_uploader">
						<div class="weui_uploader_bd">
							<div class="weui_uploader_files" id="previewImage">
								{loop $row['thumb'] $pic}
									<img src="{php echo tomedia($pic)}" class="weui_uploader_file" style="height:80px;width:auto;">
								{/loop}
							</div>
						</div>
					</div>
				</div>
			</div>
			<script>
			$(document).ready(function(){
				$("#previewImage").on("click","img",function(event){
					var imgArray = [];
					var curImageSrc = $(this).attr('src');
					var oParent = $(this).parent();
					if (curImageSrc && !oParent.attr('href')) {
						$('#previewImage img').each(function(index, el) {
							var itemSrc = $(this).attr('src');
							imgArray.push(itemSrc);
						});
						wx.previewImage({
							current: curImageSrc,
							urls: imgArray
						});
					}
				});
			});
			</script>
			{/if}
		</div>
	</div>
	{/if}
</div>
{if !empty($par['comment']) && pdo_tableexists('dayu_comment') && empty($row['commentid']) && $row['status'] == 3}
{template 'comment'}
{/if}
<script type="text/javascript">
	{if pdo_tableexists('dayu_sendkami') && !empty($par['sendkami']) && !empty($row['kid'])}
		$(function(){
			$.get("{php echo murl('entry', array('do' => 'checkcard','m' => 'dayu_sendkami'), true, true)}",{id:'{$row['kid']}'},function(data){
				if(data.message.status=='1'){
					$('#content').after(data.message.msg);
				}
			},"json");
		})
	{/if}
	/*
	{if $activity['isvoice']==1 || $activity['isrevoice']==1}
		function audioplay(id){
			var audio = document.getElementById(id);
			!audio.paused?audio.pause():audio.play();
			document.addEventListener("WeixinJSBridgeReady", function () {
				!audio.paused?audio.pause():audio.play();
			}, false); 
		}
		$(function(){
			audioplay('mp3');
		})
	{/if}
	*/
	function show(obj,id){
		var pic=document.getElementById(id).src;
		wx.previewImage({
			current: pic,
			urls: [pic]
			
		});
	}
</script>
{php $jquery=1}
{/if}
{template 'footers'}